home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
sos3-2.lha
/
include
/
err.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-01-23
|
3KB
|
73 lines
/* --------------------------------------------------------------------------
* Copyright 1992 by Forschungszentrum Informatik (FZI)
*
* You can use and distribute this software under the terms of the licence
* you should have received along with this program.
* If not or if you want additional information, write to
* Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
* D-7500 Karlsruhe 1, Germany.
* --------------------------------------------------------------------------
*/
#ifndef ERRH
#define ERRH 1
// The following definitions cope with a bug in the AT&T libraries on a sun:
// Due to the way C header files are used within C++ header files, a line
// #pragma unknown_control_flow(______sigsetjmp,______setjmp,_______setjmp)
// will appear in the output of cfront (an additional line dealing with
// register allocation will appear on a sun3).
// In the subsequent C compiler run this line causes three warnings (unknown
// functions) and an occasional error at optimization level O2 and higher.
// The definitions will just assure that a known function is named in the
// pragma directives.
#if defined(ATT) && defined(sun) && !defined(______sigsetjmp)
static void __dummy_for_pragmas__(){}
#define ______sigsetjmp __dummy_for_pragmas____Fv
#define ______setjmp __dummy_for_pragmas____Fv
#define _______setjmp __dummy_for_pragmas____Fv
#endif
#include <setjmp.h>
enum err_class { err_SYS, err_USE, err_WNG };
typedef char* err_msg;
extern const err_msg err_NOT_IMPLEMENTED;
extern const err_msg err_ABSTRACT_METHOD;
extern const err_msg err_ASSERTION_FAILED;
extern void err_raise (err_class, err_msg, char* where = 0, int copy = 1);
#define err_raise_not_implemented(m) \
err_raise(err_SYS,err_NOT_IMPLEMENTED,m,FALSE);
#define err_raise_abstract_method(m) \
err_raise(err_SYS,err_ABSTRACT_METHOD,m,FALSE);
#if ERR_NO_ASSERT
#define err_assert(b,w)
#else
#define err_assert(b,w) ((b)?1:(err_raise(err_SYS,err_ASSERTION_FAILED,w,0),0))
#endif
extern void (*err_output_handler) ();
extern int err_occurred (err_class);
extern void err_reset ();
extern err_class err_last_class ();
extern err_msg err_last_raised ();
extern char* err_last_origin ();
extern void err_push_env();
extern void err_pop_env();
extern struct err_env_stc {sigjmp_buf env; err_env_stc *next;} *err_env_stack;
#define err_block if (err_push_env(),!sigsetjmp(err_env_stack->env,0)) {
#define err_exception err_pop_env(); } else {
#define err_block_end err_pop_env(); }
#endif ERRH